﻿using DevExpress.Xpf.Charts;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PlaceOrder_Client.Formatter
{
    public class AxisLabelFormatter : IAxisLabelFormatter
    {
        public string GetAxisLabelText(object axisValue)
        {
            if (axisValue == null)
                return null;

            var stringValue = axisValue.ToString();

            if (DateTime.TryParse(stringValue, out DateTime dateTimeValue))
            {
                // 格式化为 "M/d HH:mm"
                return dateTimeValue.ToString("M/d HH:mm");
            }

            // 如果无法解析为 DateTime，则返回原始字符串
            return stringValue;
        }
    }
}
